package zm.irc.message.processor;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import zm.irc.client.IrcClient;
import zm.irc.ioc.annotation.Service;
import zm.irc.message.receive.IrcReceiveMessage;


@Service
public class PrintProcessor implements IrcMessageProcessor{
    private static final DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
    @Override
    public boolean processor(IrcClient client, IrcReceiveMessage receivedMsg) {
        if(receivedMsg.shouldPrint()){
            LocalDateTime now = LocalDateTime.now();
            String nowStr = df.format(now);
            System.out.println(nowStr + " : " + receivedMsg.getMessageForPrint());
        }
        return true;
    }
}
